<!--
 * @Description:
 * @Author: cgt
 * @Date: 2021-12-23 14:05:56
 * @LastEditors: cgt
 * @LastEditTime: 2021-12-28 19:56:13
-->
<template>
  <div>
    <el-button @click="show">显示</el-button>
    <el-button @click="refresh">刷新</el-button>
  </div>
</template>

<script>
import mixins from '../mixins';
import data from '../../assets/data/connection.json';
export default {
  name: 'ConnectDiagramTool',
  props: {
    getMap: {
      type: Function,
      required: true
    },
    getTool: {
      type: Function,
      required: true
    }
  },
  mixins: [mixins],
  data() {
    return {
      styleChanged: false
    };
  },
  watch: {},
  methods: {
    show() {
      this.getMap().impl.map.remove();
      let ele = document.getElementById('sgmap');
      this.getTool('ConnectDiagramTool').init(ele);
      this.getTool('ConnectDiagramTool').render(JSON.parse(JSON.stringify(data)));
    },
    refresh() {
      this.getTool('ConnectDiagramTool').render(JSON.parse(JSON.stringify(data)));
    }
  },
  mounted() {}
};
</script>

<style scoped>
.connect-diagram-container {
  position: fixed;
  top: 10px;
  left: 55px;
  width: 600px;
  height: 400px;
  border: 2px solid #bbbbbb;
  overflow: auto;
  z-index: 1;
}
.connect-diagram {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
}
</style>
